package edu.ccut.saturn.basecomponent.database.impl.oracle.builder;

import edu.ccut.saturn.basecomponent.database.ISaturnSQL;
import edu.ccut.saturn.basecomponent.database.SaturnSQLBuilderFactory;
import edu.ccut.saturn.basecomponent.database.impl.AbstractUpdateSQLBuilder;
import edu.ccut.saturn.component.IDataItem;

public class OracleUpdateLOBSQLBuilder extends AbstractUpdateSQLBuilder {

	@Override
	protected String getSetValueString(IDataItem iDataItem, Object value) {
		StringBuffer setValueString = new StringBuffer();
		setValueString.append(iDataItem.getColumn());
		
		if ("DATE".equals(iDataItem.getType())) {
			setValueString.append("=to_date(?, 'yyyy-mm-dd hh24:mi:ss')");
		} else {
			setValueString.append("=?");
		}
		return setValueString.toString();
	}

	@Override
	protected String getDatabaseType() {
		return SaturnSQLBuilderFactory.ORACLE;
	}

	@Override
	protected String getOperationType() {
		return ISaturnSQL.UPDATE_LOB_OPERATION;
	}
}
